Skip to main content

How to modify the camera skybox background by script using Java

How to modify the Camera skybox background by script using Java


In your Java class, do the following:

public class YourClass extends Component {

// value to control the type of sky the Camera will render
public int background = 0; // select in properties (0 for skybox, 1 for alpha and 2 for solidColor)

// creates a new SUIButton
public SUIButton button; // select in properties

// creates a new Camera
public Camera camera; // select in properties

@Override
public void start() {

}

@Override
public void repeat() {

// checking if the button was pressed
if (button.isDown()) {

// changing the type of sky rendered by the Camera if the conditional is true
camera.setBackground(background);
}
}
}